﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>

<script type="text/javascript">
    function mailDetail(uid) {
        show_cover();
        $.ajax({
            type: "POST",
            url: "/Message/MailDetail",
            data: { "UID": uid },
            success: function(data) {
                if (data != "Failed") {
                    $("#workarea-3-8").html(data);
                } else {
                    alert("发生未知错误,读取邮件失败,请刷新后再试");
                }
                hide_cover();

            }
        })
    }
</script>

<div style="width: 1100px; padding-top: 40px;">
    <%--   <%using (Ajax.BeginForm("MailReceive", new AjaxOptions { UpdateTargetId = "workarea-3-8", OnSuccess = "hide_cover()" }))
      { %>
    <p style="margin: 3px 0 3px 100px; height: 20px;">
        <span style="float: left">邮箱地址:<%=Html.TextBox("address", ViewData["address"], new { @style = "width:250px;border:solid 1px #6C92AD;" })%></span>
        <span style="float: left; margin-left: 15px;">密码:<%=Html.Password("password", ViewData["password"], new { @style = "width:250px;border:solid 1px #6C92AD;" })%></span>
        <span style="float: left; margin-left: 8px;">
            <input class="btn_style" type="submit" value="查看邮件" onclick="return show_cover()" /></span>
    </p>
    <%} %>--%>
    <hr />
    <table class='table_style'>
        <thead>
            <tr>
                <th>
                    发件人
                </th>
                <th>
                    主题
                </th>
                <th>
                    时间
                </th>
            </tr>
        </thead>
        <tbody>
            <%var mails = ViewData["mails"] as ValueMail.Receive.Model.MailHeadList; %>
            <%if (mails != null && mails.Count != 0)
              { %>
            <%var mailCount = mails.Count; %>
            <%for (var mailIndex = 0; mailIndex < mailCount; mailIndex++)
              {
                  var mail = mails[mailIndex];
               
            %>
            <tr>
                <td>
                    <%=mail.Name%>
                </td>
                <td>
                    <%--<%=Ajax.ActionLink(mail.Subject, "MailDetail", new { mailUID = mails[mailIndex].UID,mailIndex = mails[mailIndex].MailIndex }, new AjaxOptions { UpdateTargetId = "workarea-3-8" })%>--%>
                    <a onclick="mailDetail(<%=mail.UID %>)">
                        <%=mail.Subject %></a>
                </td>
                <td>
                    <%=mail.Date.ToString("yyyy-MM-dd")%>
                </td>
            </tr>
            <%} %>
            <%}
              else
              { %>
            <tr>
                <td colspan="3">
                    当前邮箱未收到任何邮件
                </td>
            </tr>
            <%} %>
        </tbody>
    </table>
</div>
